package cn.dg.controller;

import cn.dg.domian.CheckItem;
import cn.dg.entity.Result;
import cn.dg.service.CheckItemService;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author dg
 * @Date: 2019/12/18 19:46
 **/
//将返回的数据 以json 解释
@RestController
@RequestMapping("/checkItem")
public class CheckItemController {

    //远程连接
    @Reference
    private CheckItemService service;

    //将接受的数据将json转换成实体类
    @RequestMapping("/add")
    public Result add(@RequestBody CheckItem checkItem) {
        try {
            service.add(checkItem);
            return new Result(true,"添加成功");
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false,"添加失败");
        }
    }
}
